<div id="user-page" class="profile">
<div class="wrangler header module">
<!--Descriptive page name, messages and instructions-->
<h2><%= @wrangler.login %>'s Wrangling Page</h2>
	<p><%= icon_display(@wrangler) %></p>
	<!--/descriptions-->
</div>
<!--subnav-->
<ul class="navigation" role="navigation">
  <% if @fandoms.empty? %>
  <li><%= link_to 'Your lack of fandoms makes the wrangulator sad', tag_wranglers_path %></li>
  <% else %>
  <li><%= link_to 'Most recent works in your fandoms', works_path(:selected_tags => @fandoms.collect(&:id), :boolean_type => 'or') %></li>
  <% end %>
</ul>
<!--/subnav-->

<!--main content-->
<% unless @fandoms.empty? %>
  <div class="wrangler user module">
	<h3>Assigned Fandoms</h3>
  <p>Fandoms assigned to you via the <%= link_to 'tag wranglers page', tag_wranglers_path %>. The unwrangled count is the number of
  unwrangled tags which were used on works in the given fandom.</p>
  <table>
    <tr>
      <th rowspan="2">Fandom</th><th colspan="3">Unfilterable</th><th colspan="3">Unwrangled</th>
    </tr><tr>
      <th>Characters</th><th>Relationships</th><th>Freeforms</th><th>Characters</th><th>Relationships</th><th>Freeforms</th>
    </tr>
    <% for fandom in @fandoms %>
    <tr>
      <td><%= link_to fandom.name, {:controller => :tags, :action => :wrangle, :id => fandom} %></td>
      <td><%= (tag_count = fandom.characters.unfilterable.size) > 0 ? link_to(tag_count, {:controller => :tags, :action => :wrangle, :id => fandom, :show => :characters, :status => :unfilterable}) : " " %></td>
      <td><%= (tag_count = fandom.relationships.unfilterable.size)   > 0 ? link_to(tag_count, {:controller => :tags, :action => :wrangle, :id => fandom, :show => :relationships, :status => :unfilterable}) : " " %></td>
      <td><%= (tag_count = fandom.freeforms.unfilterable.size)  > 0 ? link_to(tag_count, {:controller => :tags, :action => :wrangle, :id => fandom, :show => :freeforms, :status => :unfilterable}) : " " %></td>
      <td><%= (tag_count = fandom.same_work_tags.unwrangled.by_type("Character").size) > 0 ? link_to(tag_count, {:controller => :tags, :action => :wrangle, :id => fandom, :show => :characters, :status => :unwrangled}) : " " %></td>
      <td><%= (tag_count = fandom.same_work_tags.unwrangled.by_type("Relationship").size)   > 0 ? link_to(tag_count, {:controller => :tags, :action => :wrangle, :id => fandom, :show => :relationships, :status => :unwrangled}) : " " %></td>
      <td><%= (tag_count = fandom.same_work_tags.unwrangled.by_type("Freeform").size)  > 0 ? link_to(tag_count, {:controller => :tags, :action => :wrangle, :id => fandom, :show => :freeforms, :status => :unwrangled}) : " " %></td>
    </tr>
    <% end %>
  </table>
</div>
<% end %>


<div class="wrangler user module">
<h3>Mass Wrangle New/Unwrangled Tags</h3>

<ul class="index">
  <li><%= link_to "Fandoms by media (#{@counts[:fandoms]})", tag_wranglings_path(:show => "fandoms") %></li>
  <li><%= link_to "Characters by fandom (#{@counts[:characters]})", tag_wranglings_path(:show => "characters") %></li>
  <li><%= link_to "Relationships by fandom (#{@counts[:relationships]})", tag_wranglings_path(:show => "relationships") %></li>
  <li><%= link_to "Relationships by character", tag_wranglings_path(:show => "character_relationships") %></li>
  <li><%= link_to "Freeforms by fandom (#{@counts[:freeforms]})", tag_wranglings_path(:show => "freeforms") %></li>
</ul>
</div>
<div class="wrangler user module">
	<h3>Find a Tag</h3>
<%= render :partial => 'tags/search_form' %>
</div>
<!--/content-->

<!--subnav-->
<!--/subnav-->
</div>
